package com.plian.system.wrapper.lg;

import com.plian.system.dto.lg.LawDisputeDTO;
import com.plian.system.entity.lg.LawDispute;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.lg.LawDisputeVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * @Description:
 * @Author husong
 * @Date 2023/1/31
 **/
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface LawDisputeWrapper extends BaseWrapper<LawDispute, LawDisputeDTO, LawDisputeVO> {

    @Override
    @Mappings(value = {
            @Mapping(source = "fillingUnitId", target = "fillingUnitName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "unitId", target = "unitName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "timeSpanId", target = "timeSpanIdName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "caseType", target = "caseTypeName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "economicLossType", target = "economicLossTypeName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "caseStatus", target = "caseStatusName", qualifiedByName = DICT_CODE_TO_NAME),
    })
    LawDisputeVO entityToVO(LawDispute entity);
}
